from django.contrib import admin
from lpts.models import Arch, Testclass, Testcontent, Tool,  Unit, Index,Hardware, Product, Tester, Scene,  Scenegroup, Job, Environ, Result, Value


# Register your models here.
class ArchAdmin(admin.ModelAdmin):
    fields = ['name', 'descriptions']
    list_display = ['name', 'descriptions']
admin.site.register(Arch, ArchAdmin)  

class TestclassAdmin(admin.ModelAdmin):
    fields = ["name", 'descriptions']
    list_display = ["name", 'descriptions']
admin.site.register(Testclass, TestclassAdmin)

class TestcontentAdmin(admin.ModelAdmin):
    fields = ["name", "testclass", 'descriptions']
    list_display = ["name", "testclass", 'descriptions']
admin.site.register(Testcontent, TestcontentAdmin)

class ToolAdmin(admin.ModelAdmin):
    fields = ['name', 'version', 'testclass', 'testcontent', 'descriptions']
    list_display = ['tool', 'testclass', 'testcontent', 'descriptions']
admin.site.register(Tool, ToolAdmin)

class UnitAdmin(admin.ModelAdmin):
    fields = ["name", 'descriptions']
    list_display = ["name", 'descriptions']
admin.site.register(Unit, UnitAdmin)

class IndexAdmin(admin.ModelAdmin):
    fields = ['name', 'unit', 'measure', 'testcontent', 'testclass', 'tool', 'descriptions']
    list_display = ['name', 'unit', 'measure', 'testcontent', 'testclass', 'tool', 'descriptions']
admin.site.register(Index, IndexAdmin)

class HardwareAdmin(admin.ModelAdmin):
    fields = ['name', 'cpu', 'memory', 'disk', 'network', 'others']
    list_display = ['name', 'cpu', 'memory', 'disk', 'network', 'others']
admin.site.register(Hardware, HardwareAdmin)

class ProductAdmin(admin.ModelAdmin):
    fields = ['name', 'release', 'version', 'arch', 'vendor', 'descriptions']
    list_display = ['os', 'vendor', 'descriptions']
admin.site.register(Product, ProductAdmin)

class TesterAdmin(admin.ModelAdmin):
    fields = ['name', 'position', 'company', 'mail', 'telephone']
    list_display = ['name', 'position', 'company', 'mail', 'telephone']
admin.site.register(Tester, TesterAdmin)

class SceneAdmin(admin.ModelAdmin):
    fields = ['name', 'testcontent', 'testclass', 'tool', 'parallels', 'times', 'mainparas', 'descriptions']
    list_display = ['name', 'testcontent', 'testclass', 'tool', 'parallels', 'times', 'mainparas', 'descriptions']
admin.site.register(Scene, SceneAdmin)

class ScenegroupAdmin(admin.ModelAdmin):
    fields = ['name',  'scenes',  'descriptions']
    list_display = ['name',  'descriptions']

admin.site.register(Scenegroup, ScenegroupAdmin)
    
class JobAdmin(admin.ModelAdmin):
    fields = ['jobid', 'name', 'hardware', 'os', 'scenegroup', 'tester', 'time']
    list_display = ['jobid', 'name', 'hardware', 'os', 'scenegroup',  'tester', 'time']
admin.site.register(Job, JobAdmin)

class EnvironAdmin(admin.ModelAdmin):
    fields = ['job', 'kernel', 'kernelcmd', 'runlevel', 'filesystem', 'swapsize', 'packages',
              'gcc','glibc', 'java', 'selinux', 'iptables', 'services', 'others']
    list_display = ['job', 'kernel', 'kernelcmd', 'runlevel', 'filesystem', 'swapsize', 'packages',
              'gcc','glibc', 'java', 'selinux', 'iptables', 'services', 'others']
admin.site.register(Environ, EnvironAdmin)

class ResultAdmin(admin.ModelAdmin):
    fields = ['index', 'job', 'scene', 'parallel']
    list_display = ['id', 'index', 'job', 'scene', 'parallel']
admin.site.register(Result, ResultAdmin)

class ValueAdmin(admin.ModelAdmin):
    fields = ['result', 'iter', 'value']
    list_display = ['result', 'iter', 'value']
admin.site.register(Value, ValueAdmin)

